import random
import socket
from threading import Thread


def user():
    sk = socket.socket()
    sk.connect(("127.0.0.1", 5000))

    while True:
        msg = str(random.randint(1, 9))
        sk.send(msg.encode("utf-8"))
        if not msg:
            continue
        if msg == 'q':
            break
        get_data = sk.recv(1024)
        print(f"加密的数据>>{get_data.decode('utf-8')}")

    sk.close()


for _ in range(10):
    t = Thread(target=user)
    t.start()
